"use strict";
cc._RF.push(module, 'a20d77vtBhDYJVXP5Wd6yIC', 'BroadCastMessage');
// scripts/BroadCastMessage.js

"use strict";

var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {
  value: !0
});

var i = function () {
  function t() {
    this._eventMap = [], this.nodeList = [];
  }

  return t.getInstance = function () {
    return null == this.instance && (this.instance = new t()), this.instance;
  }, t.prototype.SendMessage = function (t) {
    for (var e = [], o = 1; o < arguments.length; o++) {
      e[o - 1] = arguments[o];
    }

    for (var i = 0; i < this.nodeList.length; i++) {
      var n = this.nodeList[i];
      if (n[t]) return n[t].apply(n, e);
    }
  }, t.prototype.RegisterMessage = function (t) {
    this.nodeList.push(t);
  }, t.prototype.RemoveMessage = function (t) {
    for (var e = 0; e < this.nodeList.length; e++) {
      if (t === this.nodeList[e]) {
        this.nodeList.splice(e, 1);
        break;
      }
    }
  }, t.prototype.on = function (t, e, o) {
    void 0 === this._eventMap[t] && (this._eventMap[t] = []), this._eventMap[t].push({
      callback: e,
      target: o
    });
  }, t.prototype.emit = function (t, e) {
    var o = this._eventMap[t];
    if (void 0 !== o) for (var i = 0; i < o.length; i++) {
      var n = o[i];
      n && n.callback.call(n.target, e);
    }
  }, t.prototype.off = function (t, e) {
    var o = this._eventMap[t];
    if (void 0 !== o) for (var i = 0; i < o.length; i++) {
      var n = o[i];

      if (n && n.callback === e) {
        o[i] = void 0;
        break;
      }
    }
  }, t.instance = null, t;
}();

o["default"] = i;

cc._RF.pop();